<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ page import="bean.entity.*,bean.dal.*" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<jsp:include page="top.jsp"></jsp:include>
	<script type="text/javascript" >
		function check(){
			var userid=document.getElementById('userid').value;
			var password=document.getElementById('password').value;
			if(userid==""||userid==null){
				window.alert("账号不能为空！");
				document.login.userid.focus();
				return false;
			}
			if(password==""||password==null){
				window.alert("密码不能为空！");
				document.login.password.focus();
				return false;
			}
			return true;
		}
	</script>
	<%
		String msg = (String) session.getAttribute("msg");
		session.setAttribute("msg","");
		String userid= (String) session.getAttribute("userid");
		if(userid==null) userid="";
		User user = new User();
		UserManager userM=new UserManager();
		user=userM.getUserByUserId(userid);
		String location=user.getLocation();
	%>
<div align="center">
<table border="0" width="400px" cellspacing="0" cellpadding="0" id="table2">
	<tr><td height="50"></td></tr><tr>
   <td background="" width="400" height="86"></td>
   </tr>
</table>
<table border="0" width="300px" cellspacing="0" cellpadding="0" id="table1">
	<tr><td height="5"></td></tr><tr>
   <td class="login_msg" width="350" align="center">
	 <fieldset style="width: auto; margin: 0px auto;">
		  <legend>
		     <font style="font-size:15px" face="宋体">
		          下单
		     </font>
		  </legend>
		<font color="red">
			 <span id="message">
			 	<%if(msg==null){msg="";} %>
			 	<%=msg %>
			 </span>
		</font>
		<form method="POST" action="/express/servlet/Order?modth=add" name="login" id="login" onsubmit="return check()">
	<table border="1">
		<tr><td align="center">账&nbsp&nbsp号：</td>
			<td><div id="userid" name="userid"><%=userid %></div></td></tr>
		<tr><td align="center">姓&nbsp&nbsp名：</td>
			<td><div id="username" name="username"><%=user.getUsername() %></div></td></tr>
		<tr><td align="center">电&nbsp&nbsp话：</td>
			<td><input id="tel" name="tel" type="text" value="<%=user.getTel() %>" /></td></tr>
		<tr><td align="center">取件信息：</td>
			<td><textarea rows="5" cols="16" id="information" name="information" placeholder="请输入取件地址和取件码（取件信息错误将导致无法取件）"></textarea></td></tr>
		<tr><td align="center">送货地址：</td>
			<td><textarea rows="5" cols="16" id="location" name="location"><%=user.getLocation() %></textarea></td></tr>
		<tr><td align="center">包裹类型：</td>
			<td><select id="typeid" name="typeid">
			<%
		    	//通过JavaBean的getUsersBypageid(pageid,pagesize)读取某页的记录数据
		  		ArrayList<Goods_type> typelist=null;
		 		Iterator<Goods_type> it = null;
		 		Goods_type type = null;
		 		TypeManager typeM=new TypeManager();
		    	typelist = typeM.getTpyeAll();
		 		if(typelist!=null){	   it = typelist.iterator();}
		 	
		 		while(it!=null&&it.hasNext()){
		 		type =  it.next();	
			%>				
			<option value="<%=type.getTypeid() %>" 
			><%=type.getTypename() %></option>
			<%} %>
			</select></td></tr>
		<tr><td align="center">备&nbsp&nbsp注：</td>
			<td><textarea rows="5" cols="16" id="bz" name="bz"></textarea></td></tr>
	</table>
          &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
          <center><input type="submit" value="下单" />&nbsp;&nbsp;
		 <a href="user/placeorder.jsp"><input type="button" value="重置"/></a>&nbsp;&nbsp;
		 <a href="user/index.jsp"><input type="button" value="返回主页"/></a></center>
		 </form>
	 </fieldset>
	</td>
	</tr>
</table>
</div>
  </body>
</html>
